<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%  
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;  
%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery.js"></script>
<title>Login</title>

<script>
function login2()
{
	
	$.ajax({
		  type:"GET",
		  url: "userAction!login.action?loginType="+$("#loginType2").val()+"&nameOrEmail="+$("#nameOrEmail2").val()+"&user.password="+$("#password2").val(),		
		  success: function(mess)
		  {
		   	 if(mess.indexOf("r")>0)
		   		 alert("Login fail.You have enter an invalid account.");
		   	 else	   		  
		   	 	   window.location.href="<%=basePath%>${currentUrl}";
		  }
		});
}

function loginEvent2()
{
	if(event.keyCode==13)login2();
}
</script>

</head>
<body>
<jsp:include page="WEB-INF/head.jsp"></jsp:include>
<div id="mainForm">
<font class="bigBlue">Login</font><br>
<hr>
<font color="#666" style="font-weight:bold">Login in to take participate in.</font><br><br>

<!-- The warnning column start -->
<c:if test="${accessDenied!=null}">
<div class="roundRec" style="background-color: #A3080B;color:white;margin-bottom: 20px;width: 530px;">
<img src="<%=basePath %>/img/error.png" width="15" height="15">
You don't have permission to access or session timeout.
</div>
<% session.removeAttribute("accessDenied"); %>
</c:if>
<!-- The warnning column end -->



<!-- login form start -->

<div style="padding-left:15px;width: 530px;background-color: white;"class='roundRec'>
<div style="color:white;background-color: blue;padding: 5px;">Login</div>
<div>
<table>
<tr><td>
<div class="DivSelect"  style="background-color: white;">
<select name="loginType" class="SelectList" id="loginType2"  style="background-color: white;font-size: 16px;">
<option value="byName">Name</option>
<option value="byEmail">Email</option>
</select>
</div>
</td>
<td><input type="text" name="nameOrEmail" class="longInputStyle" id="nameOrEmail2" onkeypress="loginEvent2()"></td></tr>
<tr><td>Password</td><td><input type="password" name="user.password"class="longInputStyle" id="password2" onkeypress="loginEvent2()"></td></tr>
<tr><td><input type="button" value="Login" onclick="login2()" class="bigBtn"></td>
<td><a href="register.jsp">Create your  account</a>&nbsp;|&nbsp;<a href="index.jsp">Back to index</a></td></tr>
</table>
</div>
</div>
<!-- login form end -->
</div>
</body>

</html>